﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace NF_Tools
{
    public partial class BF_Panel : Panel
    {
        public BF_Panel()
        {
            InitializeComponent();
        }

        public BF_Panel(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }

        private Color _BF_BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(228)))), ((int)(((byte)(228)))), ((int)(((byte)(228)))));
        private bool _BF_Left = true;
        private bool _BF_Right = true;
        private bool _BF_Top = true;
        private bool _BF_Down = true;

        [Category("Ternence"), Description("边框颜色")]
        public Color BF_BorderColor
        {
            get { return _BF_BorderColor; }
            set { _BF_BorderColor = value; }
        }

        [Category("Ternence"), Description("左边框是否显示")]
        public bool BF_Left
        {
            get { return _BF_Left; }
            set { _BF_Left = value; }
        }

        [Category("Ternence"), Description("右边框是否显示")]
        public bool BF_Right
        {
            get { return _BF_Right; }
            set { _BF_Right = value; }
        }

        [Category("Ternence"), Description("上边框是否显示")]
        public bool BF_Top
        {
            get { return _BF_Top; }
            set { _BF_Top = value; }
        }

        [Category("Ternence"), Description("下边框是否显示")]
        public bool BF_Down
        {
            get { return _BF_Down; }
            set { _BF_Down = value; }
        }




        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics gs = e.Graphics;
            Pen p = new Pen(BF_BorderColor);

            if (BF_Left)
                gs.DrawLine(p, 0, 0, 0, this.Height);
            if (BF_Top)
                gs.DrawLine(p, 0, 0, this.Width, 0);
            if (BF_Right)
                gs.DrawLine(p, this.Width - 1, 0, this.Width - 1, this.Height - 1);
            if (BF_Down)
                gs.DrawLine(p, 0, this.Height - 1, this.Width - 1, this.Height - 1);

            
            base.OnPaint(e);
        }

        protected override void OnSizeChanged(EventArgs e)
        {
            this.Invalidate();
            base.OnSizeChanged(e);
        }


    }
}
